<template id="details">
  <div>
    <mt-header fixed >
      <router-link to="/" slot="left">
        <mt-button icon="back">返回</mt-button>
      </router-link>
    </mt-header>
    <img :src="list.pic"><br>
    <p>
      {{list.con}}
    </p>
    <p>
      单价{{list.price}}元
    </p>
    <p>
      {{list.detail}}
    </p>
    <mt-tabbar v-model="selected">
      <mt-tab-item id="总计">
        <!-- <p>
          {{number}}
        </p> -->
      </mt-tab-item>
      <mt-tab-item id="我的">
        <mt-button type="primary" size="small" @click="add(list.id)">添加购物车</mt-button>
      </mt-tab-item>
    </mt-tabbar>
  </div>
</template>
<script>
export default {
  mounted() {
    console.log(this.$route.params);
  },
  data() {
    return {
      selected:'0',
      data: this.$route.params.msg,
      list:[],
      number:0,
    };
  },
  created(){
    this.bb()
  },
  methods: {
    bb() {
      var that=this
      this.$http.get("./src/assets/json/shop.json")
        .then(function(response) {
          // console.log(response);
          that.list=response.data.hot[that.data];
        })
    },
    add(a) {
      this.$store.commit("bb",a);
      this.number=this.$store.state.num;
    }
  }
};
</script>